<template>
  <div class="Detail" v-for="item in getlistData" :key="item">
    <!-- 头部 -->
    <van-nav-bar title="产品详情" left-text="">
      <template #left>
        <van-icon
          name="arrow-left"
          size="18"
          color="#000000"
          @click="backList"
        />
      </template>
      <template #right>
        <van-icon name="share-o" size="22" color="#000000" />
      </template>
    </van-nav-bar>
    <div class="wrapper">
      <!-- 品牌名 -->
      <div class="brand" v-for="item in getlistData" :key="item">
        <img :src="item.imgUrl" alt="" /><a href="#">兰蔻&nbsp;></a>
      </div>
      <!-- 商品详情 -->
      <div class="cartpic">
        <img :src="item.imgUrl" alt="" />
        <p class="p1">{{ item.title }}</p>
        <p class="p2">{{ item.engTitle }}</p>
      </div>
      <div class="directions">
        <p>
          <span>产地：{{ item.place }}</span>
          <span class="dirpic">
            <img src="../../public/images/detail/direct.png" alt="" />
            使用说明
          </span>
        </p>
        <p>参考价格：{{ item.price }}&nbsp;/&nbsp;{{ item.effect }}</p>
        <p>功效：<span class="clean">清洁</span></p>
      </div>
      <div class="score">
        <span class="title">适合肤质范围</span>
        <van-icon name="question-o" />
        <img src="../../public/images/detail/CVN.png" alt="" />
        <div class="score-suit">
          <span class="skin">干油性</span>
          <div class="suit"><div class="not-suit"></div></div>
          <p class="cla-skin">
            <span>干</span><span>偏干</span><span>正常</span><span>混合</span
            ><span>偏油</span><span>油</span>
          </p>
        </div>
        <div class="score-suit">
          <span class="skin">敏感性</span>
          <div class="suit"><div class="not-suit"></div></div>
          <p class="cla-skin">
            <span>耐受</span><span>正常</span><span>轻敏</span><span>重敏</span>
          </p>
        </div>
        <div class="score-suit">
          <span class="skin">痘痘程度</span>
          <div class="suit"><div class="not-suit"></div></div>
          <p class="cla-skin">
            <span>无痘</span><span>轻度</span><span>中度</span><span>重度</span>
          </p>
        </div>
        <div class="suitable"><p>点此查看你与这款产品的匹配度</p></div>
      </div>
      <!-- 官方链接 -->
      <span class="title">官方链接</span>
      <div class="brand-link">
        <div class="bra-head">
          <img :src="item.imgUrl" alt="" />
          <span>Lancome兰蔻官方旗舰店</span>
        </div>
        <div class="bra-foot">
          <img :src="item.imgUrl" alt="" />
          <span>{{ item.title }} </span>
          <a href="">前往查看&gt;</a>
        </div>
      </div>
      <span class="title">达人点评</span>
      <img
        class="comments"
        src="../../public/images/detail/h_slices.png"
        alt=""
      />
      <span class="title">用户评价</span>
      <div class="user-evaluation">
        <div class="user-left">
          <div class="evaluation">{{ item.score }}</div>
          <div>
            <van-rate
              v-model="item.star"
              :size="14"
              color="#68dcdc"
              void-icon="star"
              void-color="#eee"
            />
          </div>
          <div class="user">{{ item.number }}人评价</div>
        </div>
        <div class="user-right">
          <div class="right">
            <img src="../../public/images/detail/ob-jstart2x.png" alt="" />
            <div class="s-tube">
              <div class="tube"></div>
              <div class="tube"></div>
              <div class="tube"></div>
              <div class="tube"></div>
              <div class="tube"></div>
            </div>
          </div>
          <p>高于91%的洁面产品75%的人会回购</p>
        </div>
      </div>
      <span class="title">热门评价</span>
      <ul class="hot-comments">
        <li>
          <img class="img" src="../../public/images/mine/touxiang.png" alt="" />
          <div>
            <span>只会抱佛脚的小朋友</span>
            <van-rate
              v-model="item.star"
              :size="14"
              color="#68dcdc"
              void-icon="star"
              void-color="#eee"
            />
            <span style="margin-left: 60px">155</span>
            <img class="simg" src="../../public/images/detail/dianzan.png" />
            <p>
              用之前记得摇晃,再按压,不用再搓,一挤出来
              就是泡泡了，用完脸没有那么油,感觉也挺水润
              啊,人生第一支洗面奶,好用啊,建议购买
            </p>
          </div>
        </li>
      </ul>
    </div>
    <div class="like-foot">
      <van-tabbar active-color="#ee0a24" inactive-color="#000">
        <van-tabbar-item icon="like-o" color="#FF999A">收藏</van-tabbar-item>
        <div class="used-foot">
          用过<van-rate
            v-model="item.star"
            :size="14"
            color="#68dcdc"
            void-icon="star"
            void-color="#eee"
          />
        </div>
      </van-tabbar>
    </div>
  </div>
</template>

<script>
import { getDetailsApi } from "@/utils/api";
export default {
  props: ["_id"],
  data() {
    return {
      getlistData: [],
    };
  },
  mounted() {
    this.listData();
  },
  methods: {
    //获取数据
    async listData() {
      const res = await getDetailsApi({
        _id: this._id,
      });
      this.getlistData = res;
    },
    //返回列表页
    backList() {
      this.$router.push("/list");
    },
  },
};
</script>

<style lang="less" scoped>
.Detail {
  .van-nav-bar {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 99;
    left: 0;
  }
  .wrapper {
    background-color: white;
    width: 100%;
    position: relative;
    top: 46px;
    padding-top: 20px;
    margin-bottom: 100px;
    .title {
      width: 104px;
      height: 32px;
      font-size: 17px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #000000;
      line-height: 31px;
      display: inline-block;
      margin-left: 15px;
      margin-top: 20px;
    }
    .brand {
      width: 89px;
      height: 38px;
      background-color: #7f7f7f;
      border-radius: 18.5px;
      margin-left: 20px;
      padding-left: 10px;
      position: relative;

      a {
        height: 37px;
        font-size: 14px;
        color: #ffffff;
        position: absolute;
        top: 13px;
        left: 42px;
      }

      img {
        width: 30px;
        padding-top: 4px;
        border-radius: 50%;
      }
    }
    .cartpic {
      margin-top: 20px;

      img {
        width: 160px;
        margin-left: 100px;
      }
      .p1 {
        width: 100%;
        height: 24px;
        text-align: center;
        font-size: 17px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #000000;
        line-height: 24px;
        margin-bottom: 8px;
      }

      .p2 {
        width: 200px;
        overflow: hidden;
        margin: auto;
        height: 24px;
        text-align: center;
        font-size: 12px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #666666;
        line-height: 24px;
        margin-bottom: 10px;
      }
    }
    .directions {
      margin-left: 20px;

      p {
        height: 23px;
        font-size: 12px;
        font-weight: bold;
        color: #666666;
        line-height: 24px;
      }

      .dirpic {
        float: right;
        margin-right: 20px;

        img {
          width: 12px;
        }
      }

      .clean {
        display: inline-block;
        width: 49px;
        height: 23px;
        border: 2px solid #64c8c8;
        border-radius: 23px;
        font-size: 12px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #68dcdc;
        line-height: 20px;
        text-align: center;
      }
    }
    .score {
      .van-icon {
        float: right;
        margin-right: 20px;
        margin-top: 20px;
      }
      img {
        width: 300px;
        margin-left: 40px;
        margin-top: 25px;
      }
      .score-suit {
        width: 100%;
        .skin {
          width: 38px;
          height: 14px;
          font-size: 13px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #48a9a9;
          line-height: 15px;
          margin-left: 40px;
          margin-right: 16px;
        }
        .suit {
          width: 234px;
          height: 8px;
          background-color: #b1e3e2;
          border-radius: 5px;
          display: inline-block;
          position: relative;
        }
        .not-suit {
          width: 100px;
          height: 8px;
          background-color: #31cbc9;
          border-radius: 5px;
          position: absolute;
          top: 0;
        }
        .cla-skin {
          margin-left: 88px;
          width: 250px;
          display: inline-flex;
          justify-content: space-around;
          span {
            width: 30px;
            height: 12px;
            font-size: 13px;
            font-family: PingFang SC;
            font-weight: bold;
            color: #6e6e6e;
            line-height: 15px;
            display: inline-block;
          }
        }
      }
      .suitable {
        border-radius: 5px;
        border: 2px solid #31cbc9;
        width: 343px;
        height: 45px;
        margin: auto;
        margin-top: 25px;

        p {
          width: 202px;
          height: 14px;
          font-size: 14px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #31cbc9;
          line-height: 45px;
          text-align: center;
          margin: auto;
        }
      }
    }
    .brand-link {
      width: 343px;
      height: 115px;
      border: solid 1.5px #e6b2b2;
      border-radius: 6px;
      margin: auto;
      margin-top: 15px;
      .bra-head {
        height: 43px;
        background-color: #ffeded;
        position: relative;
        img {
          width: 25px;
          margin: 10px 10px 10px 10px;
        }
        span {
          width: 140px;
          height: 12px;
          font-size: 12px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #e62111;
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
        }
      }
      .bra-foot {
        position: relative;
        img {
          width: 47px;
          display: inline-block;
          margin: 20px 10px 0 10px;
        }
        span {
          width: 112px;
          height: 24px;
          font-size: 14px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #000000;
          padding-top: 8px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
        }
        a {
          width: 60px;
          height: 12px;
          font-size: 12px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #ff807f;
          position: absolute;
          top: 45px;
          right: 20px;
        }
      }
    }
    .comments {
      width: 313px;
      height: 155px;
      margin: 20px 0 0px 20px;
    }
    .user-evaluation {
      display: flex;
      height: 110px;
      .user-left {
        margin: 20px 20px 20px 30px;
        .evaluation {
          width: 52px;
          height: 27px;
          font-size: 36px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #323232;
          line-height: 24px;
        }
        img {
          width: 70px;
          height: 12px;
        }
        .user {
          width: 60px;
          height: 210px;
          font-size: 10px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #999999;
          line-height: 24px;
        }
      }
      .user-right {
        margin: 20px 0 20px 10px;
        height: 100px;
        .right {
          display: flex;
          img {
            width: 50px;
            height: 60px;
          }
          .s-tube {
            display: flex;
            flex-direction: column;
            .tube {
              display: flex;
              flex-direction: column;
              display: block;
              width: 140px;
              height: 6px;
              background: #e6e6e6;
              float: right;
              margin-left: 8px;
            }
            :nth-child(2),
            :nth-child(3),
            :nth-child(4),
            :nth-child(5) {
              margin-top: 8px;
            }
          }
        }
        p {
          width: 204px;
          height: 24px;
          font-size: 12px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #64c8c9;
          line-height: 24px;
        }
      }
    }
    .hot-comments {
      li {
        display: flex;
        margin-left: 10px;
        margin-top: 20px;
        height: 130px;
        span {
          width: 115px;
          height: 13px;
          font-size: 13px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #63c8c8;
          height: 40px;
        }
        .img {
          width: 40px;
          height: 40px;
          margin-right: 10px;
        }
        .simg {
          width: 14px;
          height: 14px;
          margin-left: 6px;
        }
        p {
          padding: 10px 20px 20px 0;
          width: 290px;
          height: 54px;
          font-size: 14px;
          font-family: PingFang SC;
          font-weight: bold;
          color: #333333;
          line-height: 20px;
        }
      }
    }
  }
  .used-foot {
    width: 200px;
    height: 55px;
    font-size: 15px;
    font-family: PingFang SC;
    font-weight: bold;
    color: #000000;
    line-height: 24px;
    padding: 15px 0 0 30px;
  }
}
</style>
